<?php

class Caminho 
{
	private $controller;
	private $home;
	private $action;
	
	public function __construct($controller, $action, $home)
	{
		$this->controller = $controller;
		$this->home       = $home;
		$this->action     = $action;
	}
	
	public function getCaminho()
	{	
		$home       = $this->home;
		$controller = "{$home}/{$this->controller}";
		$action     = "{$controller}/{$this->action}";
		
		$home       = $this->getLink($home, "home");
		$controller = $this->getLink($controller, $this->controller);
		$action     = $this->getLink("{$action}", $this->action);
		
		if($this->action == "index")
		{
			return "{$home} &raquo; {$controller}";
		}
		
		return "{$home} &raquo; {$controller} &raquo; {$action}";
	}
	
	public function getLink($link, $nome)
	{
		$nome = ($nome == "index") ? "principal" : $nome;
		 
		return "<a class=\"caminho\" href=\"{$link}\">{$nome}</a>";
	}
}
?>